<!DOCTYPE html>
<html lang="en">
 <head> 
  <meta charset="utf-8" /> 
  <title>菜单管理</title> 
  <meta name="renderer" content="webkit" /> 
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> 
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> 
  <meta name="apple-mobile-web-app-status-bar-style" content="black" /> 
  <meta name="apple-mobile-web-app-capable" content="yes" /> 
  <meta name="format-detection" content="telephone=no" /> 
  <link rel="stylesheet" href="/assets/layui/css/layui.css" media="all" /> 
  <style type="text/css">
    .layui-form-item .layui-inline {
        width: 33.333%;
        float: left;
        margin-right: 0;
    }

    @media (max-width: 1240px) {
        .layui-form-item .layui-inline {
            width: 100%;
            float: none;
        }
    }
    .left-tree{
       display: inline-block;
        margin-left: 2px;
        width: 250px;
        height: 400px;
        padding: 10px;
        border: 1px solid #ddd;
        overflow: auto;
        background-color: #f2f2f2;
    }
    .rigth-content{
        display: inline-block;
        height: 400px;
        width: 600px;
        padding: 10px;
        margin-left: 10px;
        vertical-align: top;
    }
    .site-tips{
        margin-bottom: 10px;
        line-height: 22px;
        border-left: 5px solid #0078AD;
    }
</style>
 </head>  
 <body class="childrenBody"> 
  <div class="admin-main"> 
   <!-- <blockquote class="layui-elem-quote layui-quote-nm">
	  <a class="layui-btn layui-btn-small layui-btn-normal J_add_menu" href="javascript:;"> 
		 <i class="layui-icon">&#xe608;</i> 新增菜单
	  </a>
   </blockquote> -->
   <fieldset class="layui-elem-field"> 
    <legend>菜单管理</legend> 
    <div class="layui-field-box layui-form"> 
     <div class="left-tree"> 
      <form id="searchform" class="layui-form">
              <div class="layui-inline">
                <select id="platformType" lay-filter="platformType">
                  <option value="admin">后台管理系统</option>
                </select>     
              </div>                          
       </form>
      <ul id="menu_tree_cont" class="layui-box layui-tree" lay-filter="menus"></ul> 
     </div> 
     <div id="form_cont" class="site-tips rigth-content"> 
      <form class="layui-form" action="/api/perm/resource/update"> 
       <input type="hidden" name="id" bindattr="id" /> 
       <div class="layui-form-item"> 
        <label class="layui-form-label">菜单名称</label> 
        <div class="layui-input-block"> 
         <input type="text" class="layui-input" bindattr="name" name="name" lay-verify="required" /> 
        </div> 
       </div> 
       <div class="layui-form-item leaf-filter"> 
        <label class="layui-form-label">菜单链接</label> 
        <div class="layui-input-block"> 
         <input type="text" class="layui-input" bindattr="value" name="uri" lay-verify="required" /> 
        </div> 
       </div> 
       <div class="layui-form-item leaf-filter" style="display: none;"> 
        <label class="layui-form-label">关联接口</label> 
        <div id="apiListCont" class="layui-input-inline" style="width: 400px;" bindAttr="template:apiListTpl"></div> 
        <div class="layui-input-inline" style="width: 50px;">
           <a class="layui-btn layui-btn-warm layui-btn-sm J_iframe_dialog" href="javascript:;" data-url="./select-apis.html" data-title="选择接口" data-scroll="0" data-width="550" data-height="600">编辑</a>
        </div>
       </div> 
       <div class="layui-form-item"> 
        <div class="layui-input-block"> 
         <input type="button" class="layui-btn layui-btn-normal J_ajaxSubmit" value="更新" onSuccessCallback="None" /> 
         <input type="button" class="layui-btn layui-btn-danger J_confirm" data-url="/api/resource/delete/{id}" ajax-method="POST" onsuccesscallback="reloadTree" value="删除" />
        </div> 
       </div> 
      </form> 
     </div> 
    </div> 
   </fieldset> 
  </div> 
  <script type="text/html" id="apiListTpl">
  {{#  layui.each(d.apis, function(index, item){ }}
   <input type="checkbox" name="apiIds" value="{{item.value}}" title="{{item.text}}" lay-skin="primary" checked>
  {{#  }); }}
  </script>
  <script type="text/javascript" src="/assets/layui/layui.js"></script>
  <script type="text/javascript" src="/modules/resource/resource.js"></script>
  <script>
   var currentMenu;
   var selectData = {};
   var apiTreeDatas;
	function reloadApiList(){
		var data = {};
		data.apis = selectData;
		layui.laytpl(layui.jquery('#apiListTpl').html()).render(data, function(html){
			layui.jquery('#apiListCont').html(html);
			layui.form.render();
			layer.closeAll();
		});
	}

</script>  
 </body>
</html>